//
// Created by Zhang on 2022/5/14.
//

#ifndef WEEK7_DICT_H
#define WEEK7_DICT_H

#include <vector>
#include <string>

template<typename k, typename v>
class dict {
    std::vector<k> keys;
    std::vector<v> values;
public:
    v &operator[](k key) {
//        bool find = false;
        for (int i = 0; i < keys.size(); i++) {
            if (keys[i] == key) {
//                find = true;
                return values[i];
            }
        }

        keys.push_back(key);
        v *p = new v;
        values.push_back(*p);
        return values[values.size() - 1];

    };
};


#endif //WEEK7_DICT_H
